package com.zbj.feign.consumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * FeignConsumerController
 *
 * @author weigang
 * @create 2019-08-06
 **/
@RestController
@RequestMapping("/feign/consumer")
public class FeignConsumerController {

    @Autowired
    private FeignService feignService;

    @GetMapping("/hello")
    public String hello() {
        // 已经包含Ribbon功能 实现客户端负载均衡
        return feignService.hello();
    }

    @RequestMapping("/consumer2")
    public String helloConsumer2() {
        String r1 = feignService.hello("weiGang");
        String r2 = feignService.hello("weiGang", 23).toString();
        String r3 = feignService.hello(new User("weiGang", 23));
        return r1 + " ----- " + r2 + " ---- " + r3;
    }
}